package cn.itcast.mq.listener;

import cn.itcast.mq.bean.User;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class SpringRabbitListener {
    @RabbitListener(queuesToDeclare = @Queue("simple.queue"))
    public void listenerMessage(String msg) {
        System.out.println("军队接收的消息为: " + msg);
    }

    @RabbitListener(queuesToDeclare = @Queue("object.queue"))
    public void listenerObject(User user) {
        System.out.println("新任集团军元帅为: " + user);
    }
}
